﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntityBinder.Interface
{
	/// <summary>
	/// Enum for the type of binder.
	/// </summary>
	public enum BinderType
	{
		/// <summary>
		/// The binder will only produce a value.
		/// </summary>
		VALUE,
		/// <summary>
		/// The binder will be a container for other data.
		/// </summary>
		CONTAINER,
		/// <summary>
		/// The binder will be an array of value.
		/// </summary>
		ARRAY_OF_VALUE,
		/// <summary>
		/// The binder will be an array of container.
		/// </summary>
		ARRAY_OF_CONTAINER
	}

	/// <summary>
	/// Interface which defines function needed by Binders.
	/// </summary>
	public interface IBinder
	{
		/// <summary>
		/// Enum to know the type of this binder.
		/// <see cref="EntityBinder.Interface.BinderType"/>
		/// </summary>
		BinderType BinderType { get; }

		/// <summary>
		/// Function to bind content to object representation.
		/// </summary>
		/// <param name="_source">The ancestor object to store the new one.</param>
		/// <param name="_content">The content.</param>
		/// <param name="_memberAccess">Object to access the member.</param>
		/// <returns>The new created object.</returns>
		object Read(object _source, string _content, IMemberAccess _memberAccess);

		/// <summary>
		/// Method to convert object representation to string.
		/// </summary>
		/// <param name="_source">The container object.</param>
		/// <param name="_memberAccess">Object to access the member.</param>
		/// <returns>A string representation of object data.</returns>
		string Write(object _source, IMemberAccess _memberAccess);
	}
}
